namespace SeataNet.Core.Discovery.Nacos
{
    /// <summary>
    /// Nacos配置
    /// </summary>
    public class NacosConfiguration
    {
        /// <summary>
        /// Nacos服务器地址列表
        /// </summary>
        public List<string> ServerAddresses { get; set; } = new List<string> { "http://localhost:8848" };

        /// <summary>
        /// 命名空间ID
        /// </summary>
        public string Namespace { get; set; } = "public";

        /// <summary>
        /// 分组名称
        /// </summary>
        public string GroupName { get; set; } = "DEFAULT_GROUP";

        /// <summary>
        /// 集群名称
        /// </summary>
        public string ClusterName { get; set; } = "DEFAULT";

        /// <summary>
        /// 用户名（如果启用鉴权）
        /// </summary>
        public string? Username { get; set; }

        /// <summary>
        /// 密码（如果启用鉴权）
        /// </summary>
        public string? Password { get; set; }

        /// <summary>
        /// 访问密钥（Access Key）
        /// </summary>
        public string? AccessKey { get; set; }

        /// <summary>
        /// 密钥ID（Secret Key）
        /// </summary>
        public string? SecretKey { get; set; }

        /// <summary>
        /// 心跳间隔（毫秒）
        /// </summary>
        public int HeartbeatInterval { get; set; } = 5000;

        /// <summary>
        /// 心跳超时时间（毫秒）
        /// </summary>
        public int HeartbeatTimeout { get; set; } = 15000;

        /// <summary>
        /// IP删除超时时间（毫秒）
        /// </summary>
        public int IpDeleteTimeout { get; set; } = 30000;

        /// <summary>
        /// 是否为临时实例
        /// </summary>
        public bool Ephemeral { get; set; } = true;

        /// <summary>
        /// 配置长轮询超时时间（毫秒）
        /// </summary>
        public int ConfigLongPollTimeout { get; set; } = 30000;

        /// <summary>
        /// 配置监听器数量
        /// </summary>
        public int ConfigListenerCount { get; set; } = 1;

        /// <summary>
        /// 是否启用配置缓存
        /// </summary>
        public bool EnableConfigCache { get; set; } = true;

        /// <summary>
        /// 配置缓存目录
        /// </summary>
        public string ConfigCacheDir { get; set; } = "./nacos/config";

        /// <summary>
        /// 是否在启动时快速失败
        /// </summary>
        public bool FailFast { get; set; } = false;

        /// <summary>
        /// 请求超时时间（毫秒）
        /// </summary>
        public int RequestTimeout { get; set; } = 3000;

        /// <summary>
        /// 默认超时时间（毫秒）
        /// </summary>
        public int DefaultTimeout { get; set; } = 3000;
    }
}
